// 保存原始的 ResizeObserver
const OriginalResizeObserver = window.ResizeObserver;

// 创建一个简单的包装器
window.ResizeObserver = class ResizeObserver extends OriginalResizeObserver {
    constructor(callback) {
        super((entries, observer) => {
            // 使用 requestAnimationFrame 来避免调用栈溢出
            window.requestAnimationFrame(() => {
                try {
                    callback(entries, observer);
                } catch (e) {
                    if (e.message.includes('ResizeObserver') || e.message.includes('Maximum call stack size exceeded')) {
                        // 忽略 ResizeObserver 相关错误
                        return;
                    }
                    throw e;
                }
            });
        });
    }
};

export { OriginalResizeObserver }; 